<template>
  <div class="detail">
    <div class="box" v-for="(item,index) in details" :key="index">
      <div class="box-one">
        <img :src="item.cover" alt />
      </div>
      <div class="box-two">
        <p>{{item.name}}</p>
        <p>已经累计{{item.count}}份</p>
        <p>￥{{item.price}}￥{{item.oldPrice}}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "detail",
  data() {
    return {
      details: []
    };
  },
  created() {
    this.getXiang();
  },
  methods: {
    getXiang() {
      let { id } = this.$route.params;
      this.$axios.post(`/api/detail/${id}`).then(res => {
        this.details = res.data.msg;
        console.log(res);
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.detail {
  width: 100%;
  height: 100%;
  .box {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    .box-one {
      width: 100%;
      flex: 1;
      overflow: auto;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .box-two {
      width: 100%;
      height: 120px;
      background: #ccc;
    }
  }
}
</style>